<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="群发管理" name="0">
        <list />
      </el-tab-pane>
      <el-tab-pane label="群组管理" name="1" v-if="userRole === 'admin'">
        <group v-if="activeName === '1'" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import list from "./list";
import group from "./group";
import store from "@/store";
export default {
  components: {
    list,
    group,
  },
  data() {
    return {
      activeName: "0",
      userRole: "",
    };
  },

  created() {
    this.userRole = store.getters.roles[0];
  },
  methods: {
    handleClick(event) {
      this.activeName = event.name;
    },
  },
};
</script>
